import system from "@/core/models/system";
export default {
    namespaced: true,
    state: {
        messageTabIndex: 0,
        getTabIndex: 0,
        orderTabIndex: 0,
        platformData: {
            loaded: false,
            about: "",
            service: "",
            register: "",
            serviceMobile: "",
        },
        refreshGet: true,
        refreshOrder: true,
    },
    getters: {},
    mutations: {
        messageTabIndex(state, data) {
            state.messageTabIndex = data;
        },
        getTabIndex(state, data) {
            state.getTabIndex = data;
        },
        orderTabIndex(state, data) {
            state.orderTabIndex = data;
        },
        platformData(state, data) {
            state.platformData = data;
        },
        refreshGet(state, data) {
            state.refreshGet = data;
        },
        refreshOrder(state, data) {
            state.refreshOrder = data;
        }
    },
    actions: {
        async platformData(context, data) {
            if (context.state.platformData.loaded) return;
            await system.platformData().then(data => {
                context.commit('platformData', {
                    ...data,
                    loaded: true
                });
            });
        }
    }
}
